#include <iostream>
#include <gtest/gtest.h>

#include "base/logging.h"
#include "melon/client/zk_service_locator.h"

using namespace std;
using namespace base;
using namespace melon::client;

TEST(SessionService, illegal_path) {
  // LOG_INIT("./zk_service_locator_test.log", "DEBUG");
  ServiceLocator * locator = new ZkServiceLocator("10.16.15.197:2181/service_registry");
  EXPECT_EQ(locator->Locate("x/im/session_service"), "");
  EXPECT_EQ(locator->Locate("/im/session_service/v1"), "");
  EXPECT_EQ(locator->Locate("/im/session_service/v.2"), "");
  EXPECT_EQ(locator->Locate("/im/message_outlet_service/h1.0/shard_0"), "");
  cout << locator->Locate("/im/message_outlet_service/v1.0/shard_1") << endl;

  // ServiceLocator * locator = new ZkServiceLocator("10.108.79.41:2181,10.108.79.42:2181,10.108.79.43:2181/service_registry");
  // EXPECT_EQ(locator->Locate("x/bbt/bbt_message_history_service"), "");
  // cout << locator->Locate("/bbt/bbt_message_history_service") << endl;

  // EXPECT_EQ(locator->Locate("/bbt/bbt_message_history_service/v1"), "");
  // EXPECT_EQ(locator->Locate("/bbt/bbt_message_history_service/v.2"), "");
  // EXPECT_EQ(locator->Locate("/bbt/bbt_message_history_service/h1.0/shard_0"), "");
  // cout << locator->Locate("/bbt/bbt_message_history_service/v1.0/shard_1") << endl;
  // cout << locator->Locate("/bbt/bbt_message_history_service/v1.0/shard_0") << endl;
  // cout << locator->Locate("/bbt/bbt_engineer_access_service/v1.0/shard_0") << endl;
}

int main(int argc, char** argv) {
  LOG_INIT("/dev/stdout", "DEBUG");

  testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();
}

